<template>
  <el-dialog
    v-model="userInfoVisibleLocate"
    title="绑定用户信息"
    width="800"
    @close="dialogClose()"
  >
    <el-table
      :data="userInfoData"
    >
      <!-- TODO: 换成img -->
      <el-table-column
        label="头像"
        property="pic"
        width="150"
      />
      <el-table-column
        label="用户ID"
        property="userId"
        width="150"
      />
      <el-table-column
        label="昵称"
        property="nickName"
        width="150"
      />
      <el-table-column
        label="用户类型"
        property="status"
        width="150"
      />
      <el-table-column
        label="积分"
        property="point"
        width="150"
      />
      <el-table-column
        label="电话"
        property="tel"
        width="150"
      />
      <el-table-column
        label="更新时间"
        property="updateTime"
        width="150"
      />
      <el-table-column
        label="创建时间"
        property="createTime"
        width="150"
      />
    </el-table>
  </el-dialog>
</template>
<script setup>
const props = defineProps({
  userInfoData: {
    type: Array,
    default: () => [
      {
        pic: '',
        userId: 0,
        nickName: '无数据',
        status: 0,
        point: 0,
        tel: '无数据',
        updateTime: '无数据',
        createTime: '无数据'
      }
    ]
  },
  userInfoVisible: {
    type: Boolean,
    default: false
  }
})
const userInfoVisibleLocate = ref(props.userInfoVisible)

function dialogClose () {
  userInfoVisibleLocate.value = false
  emits('close')
}
const emits = defineEmits(['close'])

watchEffect(() => {
  // console.log('好像更新了' + JSON.stringify(props.userInfoData))
  userInfoVisibleLocate.value = props.userInfoVisible
})
</script>
